/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aso.upna.playlist;

import aso.upna.cancion.AbstractCancion;
import java.util.Vector;

/**
 *
 * @author triki
 */
public class GenericIterator {

    private Vector privateVector;
    private int counter;

    public GenericIterator(Vector array)
    {
        counter = 0;
        this.privateVector = array;
    }

    public boolean hasNext()
    {
        if(counter+1 <= privateVector.size())
            return true;
        else
            return false;
    }

    public Object current()
    {
        if(privateVector.size() == 0)
            return null;
        return privateVector.get(counter);
    }

    public void next()
    {
        counter+=1;
    }

    public void previous()
    {
        counter-=1;

        if(counter < 0)
            counter = 0;
    }

    public int count_elements()
    {
        return privateVector.size();
    }

    public void first()
    {
        counter = 0;
    }
}
